#include "handleaudio.h"

void HandleAudio::setHander(QString &prefix,QString &id)
{
    request.setUrl(QUrl(prefix + "session/" + id));
    request.setRawHeader("Content-Type","application/octet-stream");
}

HandleAudio::HandleAudio(QString &prefix,QString &id)
{
    setHander(prefix,id);
    manager = new QNetworkAccessManager(this);
    connect(manager,&QNetworkAccessManager::finished,this,&HandleAudio::slotReplyFromServer);
}

void HandleAudio::slotReplyFromServer(QNetworkReply *reply)
{
    if(reply->error() != QNetworkReply::NoError){
        qDebug()<<reply->error();
        // 发送post错误后需要的处理
    }
    reply->deleteLater();
}

void HandleAudio::slotSendPost(const QByteArray  qba)
{
    QNetworkReply * reply = manager->post(request,qba);
    if(reply->error() != QNetworkReply::NoError){
        qDebug()<<reply->error();
    }
}
